package com.cc.util;

import lombok.Data;
import lombok.Getter;

import java.util.List;

/**
 * @author 33314
 * @version 1.0
 * @description: TODO
 * @date 2025/4/17 19:37
 */
@Data
public class Page<T> {
    private int pageCount;//总页数
    @Getter
    private int totalCount;//总条数
    private int pageSize=5;//每页显示的条数
    private int pageIndex =1;//当前页码
    private List<T> data;//数据
    public void setTotalCount(int totalCount) {
        if (totalCount>0){
            this.totalCount = totalCount;
            //总数除以每页显示的条数有余则总页数加1
            this.pageCount=totalCount%pageSize==0?totalCount/pageSize:totalCount/pageSize+1;
        }
    }


}
